home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
LIBRARY
/
PCTV3N5
/
VBWAVE.ZIP
/
MCIDEMO.TXT
< prev
next >
Wrap
Text File
|
1992-10-14
|
3KB
|
130 lines
Dim ShouldSave As Integer
Sub Form_Unload (Cancel As Integer)
mciDemo.MMControl1.Command = "Close"
End Sub
Sub NewCmd_Click ()
CheckSave
CMDialog1.DefaultExt = "WAV"
CMDialog1.Filter = "Wave Files (*.wav)|*.wav"
CMDialog1.Action = DLG_FILE_SAVE
If MMControl1.Mode <> MCI_MODE_NOT_OPEN Then
MMControl1.Command = "Close"
End If
If CMDialog1.FileName <> "" Then
OpenMCIControl (CMDialog1.FileName)
mciDemo.Caption = "MCI Demo - " + CMDialog1.FileName
UpdateLabels
End If
End Sub
Sub OpenMCIControl (TheFile As String)
mciDemo.MMControl1.Notify = FALSE
mciDemo.MMControl1.Wait = TRUE
mciDemo.MMControl1.Shareable = FALSE
mciDemo.MMControl1.DeviceType = "WaveAudio"
mciDemo.MMControl1.FileName = TheFile$
mciDemo.MMControl1.Command = "Open"
If mciDemo.MMControl1.Error <> 0 Then
Msg$ = mciDemo.MMControl1.ErrorMessage
MsgBox Msg$
End If
mciDemo.MMControl1.RecordMode = MCI_RECORD_INSERT
End Sub
Sub OpenCmd_Click ()
CheckSave
CMDialog1.DefaultExt = "WAV"
CMDialog1.DialogTitle = "Open .WAV File"
CMDialog1.Filter = "Wave Files (*.wav)|*.wav"
CMDialog1.Action = DLG_FILE_OPEN
If MMControl1.Mode <> MCI_MODE_NOT_OPEN Then
MMControl1.Command = "Close"
End If
If CMDialog1.FileName <> "" Then
OpenMCIControl (CMDialog1.FileName)
mciDemo.Caption = "MCI Demo - " + CMDialog1.FileName
UpdateLabels
End If
End Sub
Sub CloseCmd_Click ()
CheckSave
MMControl1.Command = "Close"
End Sub
Sub SaveCmd_Click ()
If MMControl1.FileName = "noname.wav" Then
SaveAsCmd_Click
Else
MMControl1.Command = "Save"
UpdateLabels
End If
End Sub
Sub ExitCmd_Click ()
CheckSave
End
End Sub
Sub CheckSave ()
If ShouldSave Then
Msg$ = "The file in memory has changed. Save it?"
Answer% =
MsgBox(Msg$, MB_YESNOCANCEL +
MB_ICONQUESTION, "Save file?")
Select Case Answer%
Case IDYES
MMControl1.Command = "Save"
ShouldSave = FALSE
Case IDNO
ShouldSave = FALSE
Case IDCANCEL
Exit Sub
End Select
End If
End Sub
Sub MMControl1_RecordCompleted (ErrorCode As Long)
ShouldSave = TRUE
End Sub
Sub MMControl1_StatusUpdate ()
UpdateLabels
End Sub
Sub MMControl1_PrevCompleted (ErrorCode As Long)
UpdateLabels
End Sub
Sub UpdateLabels ()
lblLength.Caption = Str$(MMControl1.Length)
lblPosition.Caption = Str$(MMControl1.Position)
End Sub
Sub MMControl1_StopCompleted (ErrorCode As Long)
UpdateLabels
End Sub
Sub MMControl1_PauseCompleted (ErrorCode As Long)
UpdateLabels
End Sub
Sub MMControl1_NextCompleted (ErrorCode As Long)
UpdateLabels
End Sub
Sub MMControl1_PlayCompleted (ErrorCode As Long)
UpdateLabels
End Sub
Sub SaveAsCmd_Click ()
End Sub
Sub Form_Load ()
mciDemo.Caption = "MCI Demo - untitled"
End Sub